<?php include "inc/conn.php"; ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>在线反馈 —— 启航纺织</title>
    <link href="home/css/bootstrap.min.css" rel="stylesheet">
    <link href="home/css/master.css" rel="stylesheet">
	<link href="home/css/model.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
	<style>
		.panel-heading span{margin-right:50px}
	</style>
</head>

<body>
<!-- ##########页首########## -->
<?php include "inc/header.php"; ?>
<!-- ##########页首（end）########## -->

<!-- ##########主体########## -->


<div class="container">
	<!-- 固定图片广告 -->
	<div class="row">
		<img class="img-responsive model-img" src="uploadfiles/image/20170911/5557875ae0a45e1.jpg" alt="">
	</div>
	
	<!-- 内容 -->
	<div class="row row-3">
		<div class="col-md-3">
			<div class="model-title theme">
				联系我们
			</div>
			<div class="model-list">
				<ul class="list-group">
                    <li class="list-group-item">
						<a href="#">联系我们</a>
					</li>
					<li class="list-group-item">
						<a href="#">在线反馈</a>
					</li>
					
					
				</ul>
      
			</div>
		</div>
		<div class="col-md-9">
			<div class="model-details-title">
				在线反馈
			</div>
			<div class="model-details">
				<form class="form-horizontal">
					  <div class="form-group">
					    <label for="username" class="col-sm-2 control-label">反馈用户：</label>
					    <div class="col-sm-10">
					      <input type="text" class="form-control" id="username" placeholder="昵称">
					    </div>
					  </div>
					  <div class="form-group">
					    <label for="phone" class="col-sm-2 control-label">联系电话：</label>
					    <div class="col-sm-10">
					      <input type="text" class="form-control" id="phone" placeholder="手机">
					    </div>
					  </div>
					  <div class="form-group">
					    <label for="email" class="col-sm-2 control-label">Email：</label>
					    <div class="col-sm-10">
					      <input type="email" class="form-control" id="email" placeholder="Email">
					    </div>
					  </div>
					  <div class="form-group">
					    <label for="content" class="col-sm-2 control-label">反馈内容：</label>
					    <div class="col-sm-10">
					      <textarea class="form-control" rows="3" id="content" name="content"></textarea>
					    </div>
					  </div>
					  
					  <div class="form-group">
					    <div class="col-sm-offset-2 col-sm-10">
					      <button type="submit" class="btn btn-default">提交</button>
					    </div>
					  </div>
					</form>
				</div>
				
				<!-- 将分页链接的程序复制过来 -->
				<?php
					$pagesize = 3;	// 设置每页显示的记录数
					$page = intval(@$_GET['p']);//页码
					// 计算总页数
					$sql = "select id from message";
					
					$res=mysqli_query($conn,$sql) or die("执行检索文章命令错误".$sql);
					$count = mysqli_num_rows($res);// 总记录数
					$maxpage = ceil($count/$pagesize);	// 总数/每页显示的记录数 101/5 20.2
					
					
					// 页码有效性验证
					if($page>=$maxpage){ $page=$maxpage;}	//如果当前页次大于最大页数，则将当前页次设置为最大页数 $maxpage
					if($page<1){ $page=1;}	
					$start = ($page-1)*$pagesize;	
					$sql="select * from message order by createtime desc limit {$start},{$pagesize}";
					// 执行
					$res=mysqli_query($conn,$sql) or die("执行检索文章命令错误".$sql);
					// 循环
					while($row=mysqli_fetch_assoc($res))
					{
				?>
				<div class="row">
					<!-- 分页检索代码，参考新闻中心，只需要修改两条命令 -->
						<div class="panel panel-default">
							<div class="panel-heading">
								<span><?=date("Y-m-d h:i:s",$row['createtime'])?></span>
								<span><?=$row['username']?></span>
							</div>
							<div class="panel-body">
								<?=$row['content']?>
								<div class="panel-footer">
									<?=$row['reply']?>
								</div>
							</div>
						</div>
					<!-- while循环结束括号 -->
				</div>
				<?php } ?>
			<div class="paging">
					<?= pagelist($maxpage,$page,5)?>
			</div>
		</div>
	</div>
</div>
<!-- ##########主体（end）########## -->

<!-- ##########页脚########## -->
<?php include "inc/footer.php"; ?>
</body>
</html>
